<%-- 
    Document   : index
    Created on : Jul 10, 2011, 8:57:26 AM
    Author     : Dan de la Cruz <ddcruzg@gmail.com>
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Viajero Fashion</title>
        <!--blueprint -->
        <link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
        <link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
        <link rel="stylesheet" href="css/vfashion.css" type="text/css" media="screen, print">
        <!-- jquery -->
        <script type="text/javascript" src="js/lib/jquery161.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){

                $(".cmbselect").change(function () {
                    var cantidad = "";var paquete;
                    cantidad = $(this).find("option:selected").text();
                    var paquete = $(this).attr("title");
                    console.info(cantidad+" : "+paquete);                      

                    $.ajax({
                        type: "POST",
                        url: "Amount",
                        data: {paquete:paquete,cantidad:cantidad},
                        async:true,
                        success : function(){
                            window.location = "CheckOut";
                        }
                    });
                });
            });
        </script>
    </head>
    <body>
        <div class="container" style="text-align: left;">
            <div class="span-24 last">
                <div class="span-7" style="margin-right: 0px" >
                    <div id="left">
                        <h1>Viajero Fashion</h1>
                        <div id="copyright">
                            <p>Viajero Fashion .</p>
                            <p>Derechos reservados por <a style="color: #380202" href="#">Dan de la Cruz</a></p>
                        </div>
                    </div>
                </div>
                <div class="span-17 last">
                    <div class="span-14 append-3 last">
                        <%@include file="menu.jsp" %>
                    </div>
                    <div class="span-14 append-3 last">
                        <div id="body">
                            <div id="body-top">
                                <div id="body-bot">
                                    <h2><strong>Mi Carrito</strong></h2><br>
                                    <hr>
                                    <c:if test="${not empty sessionScope.CARRITO }">
                                        <table>
                                            <thead class="item">
                                            <th style="width: 2px;" >Id  </th>
                                            <th style="text-align: center">Paquete </th>
                                            <th>Destino</th>
                                            <th>Cantidad </th>
                                            <th>Precio </th>
                                            <th>Importe </th>
                                            <th> </th>
                                            </thead>
                                            <c:forEach items="${sessionScope.CARRITO.productos}" var="producto">
                                                <tr class="item">
                                                    <td style="width: 2px;" >${producto.paquete.idpaquete}</td>
                                                    <td> <img  src="images/paquetes/${producto.paquete.imagen}" alt="${producto.paquete.atractivo}" /></td>
                                                    <td>${producto.paquete.lugar}</td>
                                                    <td>
                                                        <select class="cmbselect" title="${producto.paquete.idpaquete}">
                                                            <c:forEach var="i" begin="1" end="${producto.cantidad+4}" step="1" varStatus ="status">
                                                                <c:choose>
                                                                    <c:when test="${producto.cantidad == i }">
                                                                        <option selected value="${i}">${i}</option>
                                                                    </c:when>
                                                                    <c:otherwise>
                                                                        <option  value="${i}">${i}</option>
                                                                    </c:otherwise>
                                                                </c:choose>


                                                            </c:forEach>

                                                        </select>
                                                    </td>
                                                    <td>${producto.paquete.precio}</td>
                                                    <td>${producto.total}</td>
                                                    <td><a href="RemovePkg?paquete=${producto.paquete.idpaquete}">Quitar</a></td>
                                                </tr>
                                            </c:forEach>
                                        </table>
                                        <hr>
                                        <div class="opcion">
                                            <div class="enlaces">
                                                <a style="padding-left: 20px;font-weight: bold;" href="ShowPkgs">VOLVER</a>
                                                <a style="padding-left: 20px;font-weight: bold;" href="BuyAll">COMPRAR</a>
                                            </div>
                                            <div class="total">
                                                <c:if test="${ CARRITO.ahorro != 0 }">
                                                    <div>
                                                        <label style="padding-left: 24px;" class="titulo"></label>
                                                        <label style="text-align:  right;" class="monto"> ${CARRITO.total} </label>
                                                    </div>
                                                    <div>
                                                        <label  class="titulo">%${CARRITO.descuento}</label>
                                                        <label style="text-align:right;padding-left: 56px;" class="titulo">- ${CARRITO.ahorro} </label>
                                                    </div>
                                                    <div><label style="padding-left: 70px;" class="monto">-------------</label></div>
                                                </c:if>
                                                <label class="titulo">Total</label>
                                                <label class="monto">S./ ${CARRITO.total - CARRITO.ahorro}</label>
                                            </div>
                                        </div>
                                    </c:if>
                                    <br>
                                    <div id="mensaje">
                                        <%@include file="mensaje.jsp" %>

                                    </div>
                                    <div class="clear"></div>
                                    <div class="body-hr"> </div>
                                    <div id="footer">
                                        <div id="footer-1">  <strong>Agentes</strong> autorizados</div>
                                        <div id="footer-2"> <img src="images/pic_2.gif" width="31" height="42" alt="Pic 2" class="left" /> Planes </div>
                                        <div id="footer-3"> <img src="images/pic_3.gif" width="60" height="42" alt="Pic 3" class="left" /> Por todo el <br>
                                            Mundo </div>
                                        <div class="clear"> </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="span-17 last"> </div>
                </div>
            </div>
        </div>
    </body>
</html>
